package com.dianxin.smartpark.web.common;

import com.chinatelecom.response.common.CommonResponseBody;
import com.dianxin.device.api.device.dto.SmartParkRelationDeviceDTO;
import com.dianxin.device.api.device.qo.SmartParkRelationDeviceRpcQO;
import com.dianxin.smartpark.service.common.SmartParkRelationDeviceService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 业务关联设备
 * 
 * @author chenjiasong
 * @date 2021-07-19
 */
@RestController
@RequestMapping("/smartpark/relation/device")
public class SmartParkRelationDeviceController {
    @Resource
    private SmartParkRelationDeviceService smartParkRelationDeviceService;

    /**
     * 查询业务关联设备列表
     */
    @RequestMapping("/list")
    public CommonResponseBody<List<SmartParkRelationDeviceDTO>>  list(@RequestBody SmartParkRelationDeviceRpcQO qo) throws Exception {
        return smartParkRelationDeviceService.selectSmartParkRelationDeviceList(qo);
    }

    /**
     * 新增业务关联设备
     */
    @RequestMapping("/add")
    public  CommonResponseBody<Boolean> add(@RequestBody SmartParkRelationDeviceDTO vo) throws Exception {
        return smartParkRelationDeviceService.insertSmartParkRelationDevice(vo);
    }

    /**
     * 删除业务关联设备
     */
	@RequestMapping("/remove")
    public  CommonResponseBody<Boolean> remove(@RequestBody SmartParkRelationDeviceDTO vo) throws Exception {
        return smartParkRelationDeviceService.deleteSmartParkRelationDevice(vo);
    }
}
